package config;

import main.Def;


public enum Config 
{
	E_PRE_SCRIPT_CONFIG("pre script", ""),
	E_SCRIPT_CONFIG("script", ""),
	E_USE_SIMPLE_FORMAT_CONFIG("simple format", "0"),
	E_IGNORE_COLUMN_CONFIG("ignore column", ""),
	E_IGNORE_SHEET_CONFIG("ignore sheet", ""),
	E_GROUP_CONFIG("group", "", "mygroup"),
	;
	
	private String m_text;
	private String m_default;
	private String m_plus;
	
	private Config(String text, String def)
	{
		m_text = text;
		m_default = def;
		m_plus = "";
	}
	
	private Config(String text, String def, String plus)
	{
		m_text = text;
		m_default = def;
		m_plus = Def.CONFIG_SPLIT + plus;
	}
	
	public String getText()
	{
		return m_text + m_plus;
	}
	
	public String getDefault()
	{
		return m_default;
	}
	
	public static Config getConfig(String text)
	{
		String[] texts = text.split(Def.CONFIG_SPLIT + "");
		text = texts[0];
		for(Config cf: Config.values())
		{
			if(text.compareTo(cf.m_text) == 0)
			{
				return cf;
			}
		}
		return null;
	}
}
